package com.changpei.core.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changpei.common.result.Result;
import com.changpei.core.pojo.Content;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 * <p>Title : Content</p>
 * <p>Description : Content</p>
 * @author weibiao
 */
@FeignClient(name = "core")
@RequestMapping("/content")
public interface ContentFeign {

    /**
     *
     * <p>Title : add</p>
     * <p>Description : 新增Content数据</p>
     * @param content
     * @return
     */
    @PostMapping(value = "/add")
    Result<Long> add(@RequestBody Content content);

    /**
     *
     * <p>Title : delete</p>
     * <p>Description : 根据ID删除Content数据</p>
     * @param id
     * @return
     */
    @DeleteMapping(value = "/{id}")
    Result<String> delete(@PathVariable Long id);

    /**
     *
     * <p>Title : update</p>
     * <p>Description : 修改Content数据</p>
     * @param content
     * @param id
     * @return
     */
    @PutMapping(value = "/{id}")
    Result<String> update(@RequestBody Content content, @PathVariable Long id);

    /**
     *
     * <p>Title : findPage</p>
     * <p>Description : Content分页搜索实现</p>
     * @param pageNum : 当前页
     * @param pageSize : 每页显示多少条
     * @return
     */
    @GetMapping(value = "/search/{pageNum}/{pageSize}")
    Result<Page<Content>> findPage(@PathVariable int pageNum, @PathVariable int pageSize);

    /**
     *
     * <p>Title : findPage</p>
     * <p>Description : Content分页条件搜索实现</p>
     * @param content
     * @param pageNum : 当前页
     * @param pageSize : 每页显示多少条
     * @return
     */
    @PostMapping(value = "/search/{pageNum}/{pageSize}")
    Result<Page<Content>> findPage(@RequestBody(required = false) Content content, @PathVariable int pageNum, @PathVariable int pageSize);

    /**
     *
     * <p>Title : findList</p>
     * <p>Description : 多条件搜索数据</p>
     * @param content
     * @return
     */
    @PostMapping(value = "/search")
    Result<List<Content>> findList(@RequestBody(required = false) Content content);

    /**
     *
     * <p>Title : findById</p>
     * <p>Description : 根据ID查询Content数据</p>
     * @param id
     * @return
     */
    @GetMapping(value = "/{id}")
    Result<Content> findById(@PathVariable Long id);

    /**
     *
     * <p>Title : findOne</p>
     * <p>Description : 多条件搜索Content数据，结果返回一条</p>
     * @param content
     * @return
     */
    @PostMapping(value = "/findOne")
    Result<Content> findOne(@RequestBody(required = false) Content content);

    /**
     *
     * <p>Title : findAll</p>
     * <p>Description : 查询Content全部数据</p>
     * @return
     */
    @GetMapping(value = "/all")
    Result<List<Content>> findAll();

    /**
     * 从ID位置查询，用于向es同步数据
     * @param id
     * @return
     */
    @GetMapping(value = "/findBaseId/{id}")
    Result<List<Content>> findBaseId(@PathVariable Long id);

    /**
     * 同步首页数据
     * @return
     */
    @GetMapping(value = "/findHome")
    Result<List<Content>> findHome();

    /**
     *
     * <p>Title : add</p>
     * <p>Description : 新增Content数据</p>
     * @param contents
     * @return
     */
    @PostMapping(value = "/addAll")
    Result<Boolean> addAll(@RequestBody List<Content> contents);
}